home *** CD-ROM | disk | FTP | other *** search
- MONITOR(3X) Last changed: 1-8-99
-
-
- NNAAMMEE
- mmoonniittoorr, mmoonnccoonnttrrooll - Prepares execution profile
-
- SSYYNNOOPPSSIISS
- ##iinncclluuddee <<ccmmppllrrss//mmoonn..hh>>
-
- ""iinntt mmoonniittoorr((iinntt _m_o_d_e, _u_n_s_i_g_n_e_d _g_r_a_i_n,, iinntt ((**_l_o_w_p_c))(()),, iinntt ((**
- _h_i_g_h_p_c))(())));;""
-
- ""vvooiidd mmoonnccoonnttrrooll((iinntt _m_o_d_e));;""
-
- IIMMPPLLEEMMEENNTTAATTIIOONN
- IRIX systems
-
- DDEESSCCRRIIPPTTIIOONN
- NOTE: These functions have been moved from the standard C library to
- the lliibbpprrooff library. If a program needs to access these routines it
- must either use the --pp option on the compiler/linker or explicitly
- link with the --llpprrooff linker option. These functions have been changed
- to work correctly with dynamic shared objects (ddssooss).
-
- Use of the --pp option during compilation and linking automatically
- generates calls to the mmoonniittoorr and mmoonnccoonnttrrooll functions. You must
- call these functions explicitly only if you want finer control over
- profiling.
-
- The following three varieties of profiling are available: program-
- counter (pc) sampling, invocation counting, and basic block counting.
- The functions described on this page provide only pc-sampling, the
- ppiixxiiee(1) command must be used to get the other types of profiling
- information.
-
- The --pp option used during linking forces the link editor (lldd) to
- include a special start-up routine mmccrrtt11..oo and the lliibbpprrooff..aa library
- that contains these routines.
-
- mmoonniittoorr((_m_o_d_e, _g_r_a_i_n, _l_o_w_p_c, _h_i_g_h_p_c)) is used to initialize pc-sampling.
- _g_r_a_i_n is the number of instruction counted in one bucket. _l_o_w_p_c and
- _h_i_g_h_p_c are currently unused. For finer control, the user can use the
- mmoonnccoonnttrrooll(()) function.
-
- mmoonniittoorr((PPCCSS__MMAAIINN,, _g_r_a_i_n,, 00,, 00)) specifies that only the MAIN module of
- a shared program is included for program counter sampling.
- mmoonniittoorr((PPCCSS__WWHHOOLLEE,, _g_r_a_i_n,, 00,, 00)) specifies that the whole program
- (including dynamic shared libraries) is included for program counter
- sampling. mmoonniittoorr((PPCCSS__MMAAIINN,, _g_r_a_i_n,, 00,, 00)) and mmoonniittoorr((PPCCSS__WWHHOOLLEE,,
- _g_r_a_i_n,, 00,, 00)) are equivalent for nonshared programs.
-
- To profile the entire program without mmccrrtt11..oo, specify the following:
-
- monitor (PCS_WHOLE, 2, 0, 0);
-
- To stop execution monitoring and write the results into an output
- file, specify the following:
-
- moncontrol (PCS_DONE);
-
- mmoonnccoonnttrrooll selectively disables and re-enables pc-sampling within a
- program. To disable pc-sampling, specify the following:
-
- moncontrol (PCS_SUSPEND);
-
- To resume, specify the following:
-
- moncontrol (PCS_RESUME);
-
- This is done automatically by a special eexxiitt function linked in with
- mmccrrtt11..oo.
-
- This allows the cost of particular operations to be measured. If any
- profiling is enabled, mmoonnccoonnttrrooll cannot prevent the program from
- generating a file of profiling information on exit.
-
- The location of the profiling output files, and whether or not calls
- to monitor will cause pc-sampling to be started, are determined by the
- PPRROOFFDDIIRR environment variable. If PPRROOFFDDIIRR is not set, the results will
- be placed in a file called mmoonn..oouutt in the current directory (unless,
- as explained later in this man page, shared address processes are
- being pc-sampled). If PPRROOFFDDIIRR is set to a nonempty string, it
- constructs a file name of the form _p_r_o_f_d_i_r/_p_r_o_g_n_a_m_e._m_o_n._p_i_d, where
- _p_r_o_f_d_i_r comes from the environment variable, _p_i_d is the process id,
- and _p_r_o_g_n_a_m_e is the aarrggvv[[00]] for the process.
-
- It is also possible via mmoonnccoonnttrrooll to profile parts of a program,
- write those results to a file, and continue profiling. The following
- function causes the current contents of the profiling buffer to be
- written to a file of the form pprrooffddiirr//pprrooggnnaammee..mmoonn..ppiidd..pphhaassee__iidd or
- mmoonn..oouutt..pphhaassee__iidd; _p_h_a_s_e__i_d is the string pp<<_n>>, where <_n> starts from 1
- and increments for each call to mmoonnccoonnttrrooll((PPCCSS__NNEEWWPPHHAASSEE)):
-
- moncontrol (PCS_NEWPHASE);
-
- The profiling buffer is cleared after every call to mmoonnccoonnttrrooll.
-
- If a program that is performing pc-sampling executes the ffoorrkk(2)
- system call, the profiling information is duplicated, and each will
- continue to pc-sample into their own buffer. However, it is important
- that PPRROOFFDDIIRR be defined, otherwise the last process to exit will
- overwrite the values in mmoonn..oouutt of the rest.
-
- If a program that is performing pc-sampling executes the sspprroocc(2)
- system call, mmccrrtt11..oo initiates profiling for the new process. At exit
- time, regardless of whether PPRROOFFDDIIRR is set, unique file names will be
- created.
-
- FFIILLEESS
- mmoonn..oouutt
- Default name for output file
-
- lliibbpprrooff..aa
- Routines for pc-sampling
-
- //uussrr//lliibb//mmccrrtt11..oo
- Special start-up routine for pc-sampling
-
- DDIIAAGGNNOOSSTTIICCSS
- mmoonniittoorr returns 0 on failure due to insufficient memory. It returns 1
- for a successful call. If the result file cannot be created or
- written to, an error message is printed on ssttddeerrrr and a 0 is returned.
- mmoonniittoorr forces the caller to exit on a failed call to mmoonniittoorr.
-
- SSEEEE AALLSSOO
- cccc(1), ppiixxiiee(1), pprrooff(1), lldd(1)
-
- ffoorrkk(2), pprrooffiill(2), sspprrooffiill(2), sspprroocc(2)
-
- This man page is available only online.
-